#include<stdio.h>
#include<stdlib.h>
int left;
int right;
int middle;
void Init(int *a,int n){
	for(int i=0;i<n;i++){
		a[i]=i;
	}
} 
int Dichotomy(int *a,int n,int key){
	left=0;
	right=n-1;
	middle=(left+right)/2;
	while(a[middle]!=key){
		if(a[middle]>key){
			right=middle-1;
			middle=(left+right)/2;
		}else{
			left=middle+1;
			middle=(left+right)/2;
		}
	}return middle;
} 
int main(){
	int a[10];
	Init(a,10);
	int b=Dichotomy( a,10,5);
	printf("%d",a[b]);
}
